import 'package:flutter/material.dart';
import 'package:flutterapp/chapter/nine/animation_9_5_widget.dart';
import 'package:flutterapp/utils/navigator_utils.dart';

import 'animation_9_1_1_scale.dart';
import 'animation_9_1_2_scale.dart';
import 'animation_9_1_3_scale.dart';
import 'animation_9_2_1_custom.dart';
import 'animation_9_3_hero.dart';
import 'animation_9_4_stagger_route.dart';
import 'animation_9_5_switcger.dart';

/// @date 2020/08/06  16:26
/// @author 程志强
/// @des 动画相关

class NineMain extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("动画"),
      ),
      body: Container(
        margin: EdgeInsets.symmetric(horizontal: 20.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: _list(context),
        ),
      ),
    );
  }

  List<Widget> _list(BuildContext context) => [
        RaisedButton(
            child: Text("基础版本1"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, AnimationScaleRoute())),
        RaisedButton(
            child: Text("基础版本2"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, AnimationScaleRoute2())),
        RaisedButton(
            child: Text("基础版本3_AnimatedBuilder"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, AnimationScaleRoute3())),
        RaisedButton(
            child: Text("自定义动画"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, CustomAnimation())),
        RaisedButton(
            child: Text("共享动画：Hero动画"),
            onPressed: () => NavigatorUtil.goPageByPush(context, HeroRoute())),
        RaisedButton(
            child: Text("交织动画"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, StaggerAnimationRoute())),
        RaisedButton(
            child: Text("动画切换:AnimatedSwitcher"),
            onPressed: () => NavigatorUtil.goPageByPush(
                context, AnimatedSwitcherCounterRoute())),
        RaisedButton(
            child: Text("动画过渡组件"),
            onPressed: () =>
                NavigatorUtil.goPageByPush(context, AnimatedTranslateRoute())),
      ];
}
